import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/views/Layout/index.vue'
import My from '@/views/My'
import News from '@/views/News'
import SearchHouse from '@/views/Search'
import Home from '@/views/Home'
import login from '@/views/My/login.vue'
import { Tabbar, TabbarItem, Button, Form, Field, NavBar, Search, Picker, Popup } from 'vant'

Vue.use(Popup) // 弹出层
Vue.use(Picker) // 选地质
Vue.use(Search) // 搜索
Vue.use(NavBar)
Vue.use(Form)
Vue.use(Field)
Vue.use(Button)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: index,
    children: [
      {
        path: '/My',
        component: My
      },
      {
        path: '/News',
        component: News
      },
      {
        path: '/Search',
        component: SearchHouse
      },
      {
        path: '/Home',
        component: Home
      },
      {
        path: '/My/login',
        component: login
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
